package com.syqc.adapter

import android.view.View
import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.syqc.comlib.utils.loadStringDImg
import com.syqc.monitor.R

/**
 *@Author Jasper
 *@Time   2021/1/15
 *@Desc   选择照片
 */
class ChoosePhotoAdapter : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_choose_photo) {
    init {
        addChildClickViewIds(R.id.iv_choose_delete)
    }

    override fun convert(holder: BaseViewHolder, item: String) {
        item.run {
            holder.getView<ImageView>(R.id.iv_choose_photo).loadStringDImg(context, this)

            holder.getView<View>(R.id.iv_choose_delete).visibility =
                if (isEmpty()) View.GONE else View.VISIBLE
        }
    }
}